//
//  KBFindTableViewCell.m
//  喜马拉雅改良版框架
//
//  Created by dllo on 15/12/23.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//
// 发现新奇Cell
#import "KBFindTableViewCell.h"

@implementation KBFindTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews
{
    // 图片
    _coverPath = [[UIImageView alloc] init];
//    _coverPath.backgroundColor = [UIColor orangeColor];
    //裁掉边框
    _coverPath.layer.masksToBounds = YES;
    //设置半径
    _coverPath.layer.cornerRadius = 35;
    //边框宽度
    _coverPath.layer.borderWidth = 0;
    //边框颜色
    _coverPath.layer.borderColor = [UIColor blueColor].CGColor;
    [self.contentView addSubview:_coverPath];
    
    [_coverPath mas_makeConstraints:^(MASConstraintMaker *make) {
        
        // 左上边约束
        make.left.and.top.mas_equalTo(10);
        // 大小约束
        make.size.mas_equalTo(CGSizeMake(70, 70));
        
    }];
    // 标题
    _title = [[UILabel alloc]init];
//    _title.backgroundColor = [UIColor yellowColor];
    [self.contentView addSubview:_title];
    
    [_title mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(_coverPath).offset(5);
        make.size.mas_equalTo(CGSizeMake(160, 25));
        make.left.equalTo(_coverPath.mas_right).offset(12);
        
    }];
    // 副标题
    _subTitle = [[UILabel alloc] init];
//    _subTitle.backgroundColor = [UIColor redColor];
    _subTitle.font = [UIFont systemFontOfSize:13];
    _subTitle.textColor = [UIColor colorWithWhite:0.571 alpha:1.000];
    [self.contentView addSubview:_subTitle];
    
    [_subTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(_title.mas_bottom).offset(5);
        make.left.mas_equalTo(_title);
        make.size.mas_equalTo(CGSizeMake(200, 18));
        
    }];
    
    UIImageView *myImage = [[UIImageView alloc]init];
    myImage.image = [UIImage imageNamed:@"findcell_arrow@2x.png"];
    [self.contentView addSubview:myImage];
    
    [myImage mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.right.mas_equalTo(-20);
        make.top.mas_equalTo(45);
        make.size.mas_equalTo(CGSizeMake(10, 12));
        
    }];
}

- (void)setDataDic:(NSDictionary *)dataDic
{
    _dataDic = dataDic;
    NSURL *url = [NSURL URLWithString:_dataDic[@"coverPath"]];
    [_coverPath sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:ImagePlaceHolder]];
    
    _subTitle.text = _dataDic[@"subtitle"];
    
    _title.text = _dataDic[@"title"];

}


















- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
